var user = {
    "name":"admin",
    "roleName":"管理员"
}

var alarmInfo = [];

var menus = [{
    "name": "气体检测",
    "icon": "",
    "subMenus": [{
        "name": "测点设置",
        "page": "svg.html",
        "icon": "../images/04.gif"
    }, {
        "name": "数据列表",
        "page": "realTimeList",
        "icon": "../images/10.gif"
    }, {
        "name": "模拟显示",
        "page": "svg.html",
        "icon": "../images/02.gif"
    }, {
        "name": "曲线显示",
        "page": "svg.html",
        "icon": "../images/09.gif"
    }, {
        "name": "查询",
        "page": "svg.html",
        "icon": "../images/07.gif"
    }, {
        "name": "报表",
        "page": "svg.html",
        "icon": "../images/06.gif"
    }]
}];

var initLayout = function() {
    $("body").height($(window).height());
    $("#left").height($(window).height() - 183);
    $("#right_main").height($(window).height() - 188);
    var height_li = $(".left_nav li .left_nav_title").height() * $(".left_nav li").length;
    $(".left_list_nr").height($("#left").height() - height_li - 130);

    $(".nav_news li").hover(function () {
        $(".nav_news li.active").removeClass("active");
        $("#btn_block .nav_tab").removeClass("btn_block");
        var index = $(this).index();
        $("#btn_block .nav_tab").eq(index).addClass("btn_block");
        $(this).addClass("active");
    })

    $("#showerror").click(function() {
        toastr.error("报警ＸＸＸ", "XXX号报警提示")
    });
    $("#showwarning").click(function() {
        toastr.warning("警告请检查ＸＸＸ", "Simple notification!")
    });
}

angular.module("main", ['ngRoute', 'main.realTimeList']).service("menus", function () {
    return menus;
}).config(['$routeProvider', function ($routeProvider) {
    $routeProvider.otherwise({redirectTo: '/realTimeList'});
}]).controller('MainController', function ($scope, menus) {
    $scope.menus = menus;
    $scope.appName = "矿井采空区安全监测预警系统";
    $scope.user = user;
    $scope.alarmInfo = alarmInfo;

    initLayout();
    $(window).resize(function () {
        initLayout();
    });
});